package thread;

public class SyncAPIDemo1 {
    public static void main(String[] args) {
        StringBuffer sb = new StringBuffer();
        new Thread(()->{
            for (int i = 0; i < 1000; ++i) {
                sb.append("a");
            }
        }).start();
        new Thread(()->{
            for (int i = 0; i < 1000; ++i) {
                sb.append("a");
            }
        }).start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
//            e.printStackTrace();
        }
        System.out.println(sb.length());
    }
}
